'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 推送
 * @author sundbcn@gmail.com (sun debing)
 */

var eventType = require('../consts/eventType');
var channelUtil = require('../util/channelUtil');
var mgrUtil = require('../util/mgrUtil');

/**
 * 发送世界聊天
 */
exports.sendWorld = function (params, cb) {
    mgrUtil.sendGlobalMessage(
        eventType.ON_CHAT_WORLD,
        params,
        channelUtil.getGlobalChannelName(),
        cb
    );
};

/**
 * 发送私聊
 */
exports.sendPrivate = function (role_id, params, cb) {
    mgrUtil.sendStatusMessage(
        [role_id],
        eventType.ON_CHAT_PRIVATE,
        params,
        cb
    );
};

/**
 * 发送军团聊天
 */
exports.sendUnion = function (union_id, params, cb) {
    mgrUtil.sendGlobalMessage(
        eventType.ON_CHAT_UNION,
        params,
        union_id,
        cb
    );
};

/**
 * 发送走马灯公告
 */
exports.sendMarquee = function (params, cb) {
    mgrUtil.sendGlobalMessage(
        eventType.ON_ALLMESSAGE_CHANGE,
        params,
        channelUtil.getGlobalChannelName(),
        cb
    );
};
